﻿
namespace Numbrella.Tracker.Data
{
    using System.Linq;

    public class UsersQueries
    {
        private readonly DatabaseEntities entities;

        public UsersQueries(DatabaseEntities entities)
        {
            this.entities = entities;
        }

        public User Get(string userName)
        {
            var userQuery = from u in this.entities.Users
                            where u.Name == userName
                            select u;
            return (userQuery.Count() == 0) ? null : userQuery.First();
        }
    }
}